<!DOCTYPE html>
<html lang="zh" class="no-js">

<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>后台登录</title>
    <link rel="stylesheet" type="text/css" href="../css/normalize.css"/>
    <link rel="stylesheet" type="text/css" href="../fonts/font-awesome-4.2.0/css/font-awesome.min.css"/>
    <link rel="stylesheet" type="text/css" href="../css/demo.css"/>
    <link rel="stylesheet" type="text/css" href="../css/component.css"/>
    <!--[if IE]>
    <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <![endif]-->

    <!--弹出层样式-->
    <link rel="stylesheet" href="../css/alert.css">
    <script src='../js/alert.js'></script>

    <script src="../js/jquery-3.3.1.js"></script>
    <script>
        function login() {
            var url="/AdminS";
            var param={
                "method":"login",
                "username":$("#input-10").val(),
                "password":$("#input-11").val()
            }
            $.post(url,param,function (data) {
                var M = {}
                if (data.flag){
                    //登陆成功提示信息
                    if (M.dialog1) {
                        return M.dialog1.show();
                    }
                    M.dialog1 = jqueryAlert({
                        'content': data.message, //此处可以获取到服务器传递过来的信息
                        'modal': true,
                        'closeTime': 2000
                    });
                    jump(2);

                } else{
                    //登陆失败提示信息
                    if (M.dialog1) {
                        return M.dialog1.show();
                    }
                    M.dialog1 = jqueryAlert({
                        'content': data.message, //此处可以获取到服务器传递过来的信息
                        'modal': true,
                        'closeTime': 2000
                    })
                }
            },"json")
        }

        function jump(count) {
            window.setTimeout(function () {
                count--;
                if (count > 0) {
                    jump(count);
                } else {
                    location.href = "/AdminS?method=selectAllVideo";
                }
            }, 1000);
        }
    </script>


    <!-- 右侧登录为按钮 -->
</head>

<body>
<div class="container">
    <header class="codrops-header">
        <h1>远航dream师生系统 <span>后台管理系统</span></h1>
    </header>

    <section class="content bgcolor-7">
			<span class="input input--jiro">
				<input class="input__field input__field--jiro" type="text" id="input-10"/>
				<label class="input__label input__label--jiro" for="input-10">
					<span class="input__label-content input__label-content--jiro">用户名</span>
				</label>
			</span>
        <span class="input input--jiro">
				<input class="input__field input__field--jiro" type="text" id="input-11"/>
				<label class="input__label input__label--jiro" for="input-11">
					<span class="input__label-content input__label-content--jiro">密码</span>
				</label>
			</span>
        <!--<span class="input input&#45;&#45;jiro">-->
				<!--<input class="input__field input__field&#45;&#45;jiro" type="text" id="input-12"/>-->
				<!--<label class="input__label input__label&#45;&#45;jiro" for="input-12">-->
					<!--<span class="input__label-content input__label-content&#45;&#45;jiro">邮箱</span>-->
				<!--</label>-->
			<!--</span>-->
        <button onclick="login()"><a href="javascript:;"> 登录</a></button>
    </section>

</div><!-- /container -->
<script src="../js/classie.js"></script>
<script>
    (function () {
        // trim polyfill : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
        if (!String.prototype.trim) {
            (function () {
                // Make sure we trim BOM and NBSP
                var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
                String.prototype.trim = function () {
                    return this.replace(rtrim, '');
                };
            })();
        }

        [].slice.call(document.querySelectorAll('input.input__field')).forEach(function (inputEl) {
            // in case the input is already filled..
            if (inputEl.value.trim() !== '') {
                classie.add(inputEl.parentNode, 'input--filled');
            }

            // events:
            inputEl.addEventListener('focus', onInputFocus);
            inputEl.addEventListener('blur', onInputBlur);
        });

        function onInputFocus(ev) {
            classie.add(ev.target.parentNode, 'input--filled');
        }

        function onInputBlur(ev) {
            if (ev.target.value.trim() === '') {
                classie.remove(ev.target.parentNode, 'input--filled');
            }
        }
    })();
</script>
</body>

</html>